// src/api/system/document.js
import request from '@/utils/request'

// 获取文档列表
export function listDocument(query) {
  return request({
    url: '/system/document/list',
    method: 'get',
    params: query
  })
}

// 获取文档详情
export function getDocument(documentId) {
  return request({
    url: '/system/document/content/' + documentId,
    method: 'get'
  })
}

// 上传文档
export function uploadDocument(data) {
  return request({
    url: '/system/document/upload',
    method: 'post',
    data: data,
    headers: { 'Content-Type': 'multipart/form-data' }
  })
}

// 更新文档内容
export function saveDocument(data) {
  return request({
    url: '/system/document/save',
    method: 'post',
    data: data
  })
}

// 删除文档
export function deleteDocument(documentId) {
  return request({
    url: '/system/document/' + documentId,
    method: 'delete'
  })
}